package org.example;

public class Main {
    public static void main(String[] args) {
        final long time1 = System.currentTimeMillis();
        double[] result = null;

        for (int i = 1; i <= 10; i++) {
            result = YyFloat64AddSub(0, 314159265);
        }
        long costTime = System.currentTimeMillis() - time1;
        System.out.printf("单次平均耗时：%d ms, 结果:( %f, %f)", costTime / 10, result[0], result[1]);
    }

    // 1亿次浮点型加减法混合运算
    static double[] YyFloat64AddSub(double N1, double N2) {
        for (int i = 1; i <= 100000000; i++) {
            N1 += 3.14;
            N2 -= 3.14;
        }
        return new double[]{N1, N2};
    }

}